package com.wanxi.feign;

import com.wanxi.dto.AliPayDTO;
import com.wanxi.dto.OrderDTO;
import com.wanxi.dto.OrderDetailsDTO;
import com.wanxi.query.OrderDetailsQuery;
import com.wanxi.query.OrderQuery;
import com.wanxi.result.CommonResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;


@FeignClient(value = "order-server",path = "/order")
public interface OrderClient {

    @ApiOperation(value = "添加订单接口",response = CommonResult.class)
    @PostMapping("/addOrder")
    public CommonResult<?> addOrder(@RequestBody OrderDTO orderDTO);

    @ApiOperation(value = "根据订单编号删除订单信息接口",response = CommonResult.class)
    @PutMapping("/deleteOrder")
    public CommonResult<?> deleteOrder(@RequestBody OrderDTO orderDTO);

    @ApiOperation(value = "根据订单编号修改订单状态接口",response = CommonResult.class)
    @PutMapping("/updateOrder")
    public CommonResult<?> updateOrder(@RequestBody OrderDTO orderDTO);

    @ApiOperation(value = "查询订单信息接口",response = CommonResult.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "OK",response = OrderDTO.class,responseContainer = "List")
    })
    @GetMapping("/findOrder")
    public CommonResult<?> findOrder(@SpringQueryMap OrderQuery orderQuery);


    @ApiOperation(value = "添加订单详情接口",response = CommonResult.class)
    @PostMapping("/addOrderDetails")
    public CommonResult<?> addOrderDetails(@RequestBody OrderDetailsDTO orderDetailsDTO);

    @ApiOperation(value = "根据订单编号删除订单详情接口",response = CommonResult.class)
    @PutMapping("/deleteOrderDetails")
    public CommonResult<?> deleteOrderDetails(@RequestBody OrderDetailsDTO orderDetailsDTO);

    @ApiOperation(value = "根据订单编号修改订单详情状态接口",response = CommonResult.class)
    @PutMapping("/updateOrderDetails")
    public CommonResult<?> updateOrderDetails(@RequestBody OrderDetailsDTO orderDetailsDTO);

    @ApiOperation(value = "查询订单详情接口",response = CommonResult.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "OK",response = OrderDetailsDTO.class,responseContainer = "List")
    })
    @GetMapping("/findOrderDetails")
    public CommonResult<?> findOrderDetails(@SpringQueryMap OrderDetailsQuery orderDetailsQuery);

    @ApiOperation(value = "调用接口")
    @GetMapping("/pay")
    public String pay(@RequestBody AliPayDTO aliPayDTO);

    @ApiOperation(value = "回调接口",response = CommonResult.class)
    @PostMapping("/notify")
    public CommonResult<?> payNotify(HttpServletRequest request) throws Exception;

}
